<!doctype html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../css/mui.css" rel="stylesheet" />
		<link href="../../css/list.css" rel="stylesheet" />
		<script src="../../js/mui.min.js"></script>
		 <script src="../../js/app.js"></script>
		 <link href="../../css/style.css" rel="stylesheet" />
<!--		 <link href="../css/icons-extra.css" rel="stylesheet"/>-->
<link rel="stylesheet" href="../css/detail.css" type="text/css" />
		 		<script src="../js/common.js"></script>
		 		<style type="text/css">

		 		</style>
</head>
<header class="mui-bar mui-bar-nav">
    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
  <h1 class="mui-title"><span id="title">订单详情</span></h1><p id="titleright" style="float: right;font-size: 0.6em;"></p>
</header>

    <div class="mui-content">

    <li class="mui-content-padded" id="user"></li>
<!--    <div class="slide-box" id="user"></div>-->
    <!--出品公司-->
      <!--项目概况表格-->
    <div id="table" class="mui-content-padded"></div>
     <li class="mui-content-padded"id="source"></li>
      <!--来源-->
    </div>
<script type="text/javascript">

 //获取详情
function jsonarrfor(result){
	switch(result.status){
		case '0':
		status='<span class="mui-btn" style="float:right" onclick="del('+result.sn+')">删除订单</span><span class="mui-btn" style="float:right;" onclick="del('+result.sn+')">立即支付</span>';
		state='<span style="color:red">未付款</span>';
		  break;
		case '1':
		state='<span style="color:red">未发货</span>';
		  break;
		  case '2':
		state='<span style="color:red">待签收</span>';
		  break;
		  case '3':
		state='完成';
		  break;
		default:
		state='<span class="mui-btn" style="float:right;bottom:5px" onclick="del('+result[i].sn+')">删除订单</span>';
		}

	casestate='<h3>订单金额:<span style="color:red">'+(result.amount/100)+'</span>元</h3><span >'+state+'</span><br><span style="border-radius:25px;border:2px solid #a1a1a1;padding:2px 5px">聊聊</span>';


//发布日期
var createtime=new Date(parseInt(result.createtime) * 1000).format('yyyy年M月d日 hh:mm:ss');
val='<div style="text-align:center"><h4>商户:'+result.shopname+'</h4><p  style="background: transparent;" onclick="goto(\'chat\',\'user\',\'detail\','+result.user_id+')">'+casestate+'</p></div><p style="border-bottom:solid 1px #D1D1D1;"><span >订单编号:'+result.sn+'</span></p><p style="border-bottom:solid 1px #D1D1D1;"><span>下单时间：'+createtime+'</span></p>';
//形象头像
document.getElementById('user').innerHTML=val;
//判断筹备进度达到100%屏蔽表格

		if(result.price){
				price=result.price.split(",");// 
				num=result.num.split(",");// 
				poster=result.poster.split(",");//
				title=result.title.split(",");//
				notes=result.notes.split(",");//
				detail=result.detail.split(",");//
				var table='';
			for(var ib=0;ib<price.length;ib++){
			table='<h4 style="margin-top:40px;background:#FAEBD7;padding:5px">商品信息['+(ib+1)+']</h4>'+
			'<img class="mui-media-object mui-pull-left" style="width:50%;margin-left:25%" src="'+home.uploads+'/img/item/'+poster[ib]+'">'+
			'<div class="list-head" ><table><tr><td width="110px">名称</td><td>'+title[ib]+'</td></tr><tr><td>单价</td><td>'+(price[ib]/100)+'元</td></tr><tr><td>数量</td><td>'+num[ib]+'</td></tr><tr><td>合计</td><td>'+(num[ib]*price[ib]/100)+'元</td></tr><tr><td>备注</td><td>'+notes[ib]+'</td></tr></table></div><h4>详情</h4><p><span id="synopsis">'+detail[ib]+'</span></p>';
			document.getElementById('table').innerHTML+=table;
			}
		}
//document.getElementById('source').innerHTML='<p style="border-bottom:solid 1px #333;"><span style="margin-left:20px">下单日期：'+createtime+'</span></p>';
//document.getElementById('titleright').innerHTML='<div id="report" style="margin-top:10px;float:right"></div><div style="float:right"><select style="padding:10px;background-color:transparent;" onchange="report('+result.id+',\'item\',this)"><option>投诉</option><option>色情</option><option>侵权</option><option>脏话</option><option>诽谤</option><option>低俗</option><option>虚假</option><option>其他</option></select></div>';
}


apptoken['tid']=tid;//获取主题详情id
apptoken['act']='detail';
mui.post(home.hos+'/Order/user?tid='+apptoken['tid'],apptoken,function(data){
	alert("服务器"+data+apptoken['tid']);
	if(isJSON(data)){
//      			alert(data);
		result=JSON.parse(data);//获取信息
//		for (var i=0;i<result.length;i++) {
		jsonarrfor(result);//加载详情信息	
//		}
		}else{
			alert(apptoken['tid']+'页面加载失败，或不存在，请重新尝试');
			return false;
    	}
})

function goto(module,room,htmlname,this_id){//我的微博
	localStorage[module+room+htmlname+'id']=this_id;
	mui.openWindow('../../'+module+'/'+room+'/'+htmlname+'.html');
	}
  </script>